package pl.edu.pw.polygen.menu.commands;


import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import pl.edu.pw.polygen.db.dao.UserDao;
import pl.edu.pw.polygen.db.entieties.User;

import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;

@Component
public class SaveAsCommand implements Command {
	

	private static final long serialVersionUID = 7875336550119938214L;
	
	@Autowired
	private UserDao userDao;
	@Override
	public void menuSelected(MenuItem selectedItem) {
		System.out.println(selectedItem.getText());
		User user = new User();
		user.setLogin("admin");
		user.setPasswd("21232f297a57a5a743894a0e4a801fc3");
		user.setLastVisit(new Date());
		userDao.saveOrUpdate(user);
	}

}
